package com.youlu.campus.web.common.base.delay;

import org.apache.commons.lang3.StringUtils;

public enum DelayQueueServiceSceneEnum {

    CREATE_GROUP("create_group", CreateGroupDelayHandleService.class, "创建小组任务");

    private String scene;

    private Class clazz;

    private String desc;

    DelayQueueServiceSceneEnum(String scene, Class clazz, String desc) {
        this.scene = scene;
        this.clazz = clazz;
        this.desc = desc;
    }

    public String getScene() {
        return scene;
    }

    public void setScene(String scene) {
        this.scene = scene;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public Class getClazz() {
        return clazz;
    }

    public void setClazz(Class clazz) {
        this.clazz = clazz;
    }

    public static Class getClassByScene(String scene) {
        if (StringUtils.isBlank(scene)) {
            return null;
        }
        for (DelayQueueServiceSceneEnum typeEnum : DelayQueueServiceSceneEnum.values()) {
            if (typeEnum.getScene().equals(scene)) {
                return typeEnum.getClazz();
            }
        }
        return null;
    }
}
